package com.bjx.common.core.util;

import javax.servlet.http.HttpServletResponse;

/**
 * @desc: 下载工具
 * @author: liushuai
 * @date: 2022/9/23 15:52
 */
public class DownloadUtil {

    /**
     * 下载Zip文件
     * @param response
     * @param zipName
     * @Author: liushuai
     * @Date: 2022/9/23 15:54
     */
    public  static void downloadZip(HttpServletResponse response, String zipName) {
        response.reset(); // 重点突出
        // 不同类型的文件对应不同的MIME类型
        response.setContentType("application/x-msdownload");
        response.setCharacterEncoding("utf-8");
        response.setHeader("Content-disposition", "attachment;filename=" + zipName + ".zip");
    }
}
